<?php

namespace app\controller;

use support\Response;

class BaseController
{

    public function success(array $data = [], string $msg = 'success', string $code = "00000"): Response
    {
        return json([
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ]);
    }

    public function error(string $msg = 'error', string $code = "B0001"): Response
    {
        return json([
            'code' => $code,
            'msg' => $msg
        ]);
    }
}
